package co.com.jtune.services;

import co.com.jtune.controller.LibraryController;
import co.com.jtune.controller.TunePlayerController;
import co.com.jtune.controller.implementations.LibraryControllerImpl;
import co.com.jtune.controller.implementations.TunePlayerControllerImpl;
import co.com.jtune.persistence.localPersistence.LocalPersistenceTrackImpl;

/**
 * http://hessian.caucho.com/
 * Clase que se encarga de instanciar los controllers
 * @author agutierrez
 *
 */
public class ServiceFactory {
	
	private static ServiceFactory instance;
	
	private ServiceFactory()
	{
		
	}
	
	public static ServiceFactory getInstance()
	{
		if(instance == null)
			instance = new ServiceFactory();
		
		return instance;
	}
	
	
	public LibraryController getLibraryController()
	{
		return new LibraryControllerImpl(LocalPersistenceTrackImpl.getTrackPersistenceInstance());
	}
	
	public TunePlayerController getTunePlayerController()
	{
		return new TunePlayerControllerImpl();
	}
	
	public <T> T createService(Class<T> controller)
	{
		//TODO Buscar la forma de crear las instancias de los controllers usando Generic		
		return null;
	}
	

}